from download import down
import pymongo
# client["47.75.39.50"] = pymongo.MongoClient("47.75.39.50",socketKeepAlive=True,maxPoolSize=200)
# cli = client["47.75.39.50"].admin.authenticate("admin321", "dsf::6666,,<<", mechanism='SCRAM-SHA-1')
# for x in cli.city.store:
#     down.delay(x[""])

import MySQLdb
import MySQLdb.cursors
mysqldb = MySQLdb.connect("127.0.0.1","root","root", "shantianjunbak",charset="utf8",cursorclass=MySQLdb.cursors.DictCursor)
cursor = mysqldb.cursor()

cursor.execute("select movie,thumb from movies")
for y in cursor.fetchallDict():
    print y["thumb"]
    down.delay(y["thumb"])
    down.delay(y["movie"])
cursor.execute("select cover,smallcover from store")
for y in cursor.fetchallDict():
    print y["cover"]
    down.delay(y["cover"])
    down.delay(y["smallcover"])

cursor.execute("select imgs,thumb from girl")
for y in cursor.fetchallDict():
    # import ipdb;ipdb.set_trace()
    print y["thumb"]
    down.delay(y["thumb"])
    y = y["imgs"].split(",")
    for yy in y:
        down.delay(yy)
cursor.execute("select thumb from diary")
for y in cursor.fetchallDict():
    print y["thumb"]
    down.delay(y["thumb"])